using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236

namespace ShopPowerTemplate.Common.Validation
{
    public partial class ValidationControl : UserControl
    {
        public ValidationControl()
        {
            this.InitializeComponent();
        }

        public TextBlock ValidationMessage { get { return this.tbxValidationMessage; } }

        public static readonly DependencyProperty PropertyToValidateProperty =
            DependencyProperty.Register("PropertyToValidate", typeof(object), typeof(ValidationControl), new PropertyMetadata(new PropertyChangedCallback(ValidationControl.OnPropertyToValidatePropertyChanged)));

        public object PropertyToValidate
        {
            get { return base.GetValue(PropertyToValidateProperty); }
            set { base.SetValue(PropertyToValidateProperty, value); }
        }

        private static void OnPropertyToValidatePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            //you can add some additional logic here.
        }

        public virtual bool Validate()
        {
            return true;
        }
    }
}
